﻿using log4net;
using log4net.Config;
using log4net.Repository;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Server.Kestrel.Https;
using System;
using System.IO;

namespace 语文字帖
{
    public class Program
    {
        public static ILoggerRepository repository { get; set; }

        public static void Main(string[] args)
        {
            repository = LogManager.CreateRepository("NETCoreRepository");
            XmlConfigurator.Configure(repository, new FileInfo("log4net.config"));
            CreateWebHostBuilder(args).Build().Run();
        }

        public static IWebHostBuilder CreateWebHostBuilder(string[] args)
        {
            Func<string, string, string> oneparam = (a, b) => a;
            return WebHost.CreateDefaultBuilder(args)
              .UseStartup<Startup>().ConfigureKestrel(o =>
              {
                  //将服务器配置为需要证书
                  o.ConfigureHttpsDefaults(o => o.ClientCertificateMode = ClientCertificateMode.RequireCertificate);
              });
            //.UseKestrel(options =>
            //{
            //    options.Listen(System.Net.IPAddress.Any, 5002, ListenOptions =>
            //    {
            //        ListenOptions.UseHttps(@"D:\www.xmdata.wang.pfx", File.ReadAllText(@"D:\keystorePass.txt"));
            //    });
            //});
        }
    }
}
